﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace DMS.Web.Common.Controls
{
    public partial class SelectedValues : System.Web.UI.UserControl
    {
        public string RootTitle
        {
            get
            {
                return this.hidRootTitle.Value;
            }
            set
            {
                this.hidRootTitle.Value = value;
            }
        }
        public string ItemTitle
        {
            get
            {
                return this.hidItemTitle.Value;
            }
            set
            {
                this.hidItemTitle.Value = value;
            }
        }
        protected string RootTitleBegin
        {
            get
            {
                return string.Format("<{0}>", this.RootTitle);
            }
        }
        protected string RootTitleEnd
        {
            get
            {
                return string.Format("</{0}>", this.RootTitle);
            }
        }
        private string _ItemSeparator = ",";

        public string ItemSeparator
        {
            get { return _ItemSeparator; }
            set { _ItemSeparator = value; }
        }
        
        public ListBox SelectedCtrl
        {
            get
            {
                return this.lbSelectedItems;
            }
        }
        public Unit Width
        {
            get
            {
                return this.lbSelectedItems.Width;
            }
            set
            {
                this.lbSelectedItems.Width = value;
            }
        }
        public int Rows
        {
            get
            {
                return this.lbSelectedItems.Rows;
            }
            set
            {
                this.lbSelectedItems.Rows = value;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.InitCtrls();
            }
        }

        private void InitCtrls()
        {
            this.lbSelectedItems.Attributes["ondblclick"] = "javascript:RemoveItem(this);";
        }

        public string Display
        {
            get
            {
                return this.dvHolder.Style[HtmlTextWriterStyle.Display].ToString();
            }
            set
            {
                this.dvHolder.Style[HtmlTextWriterStyle.Display] = value;
            }
        }
    }
}